<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Position;
use Tools;

class IndexController extends Controller
{
    public function index()
    {
        return view('Home.Index.index');
    }

    public function job(Request $request)
    {
        $page = $request->input('page');

        $page_info = Tools::page_helper($page,config('base.home_limit.base_limit.render_limit'),config('base.home_limit.base_limit.limit'));

        $list = Position::getList($page_info['skip'],$page_info['limit'],['status'=>1,'state'=>1],[],false,false,true);

        $count = Position::getCount();

        $num = intval(ceil($count/config('base.home_limit.base_limit.limit')));

        return view('Home.Index.job',compact('list','page','num'));
    }
}